<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        /* 相对定位 */
        div{
            width: 200px;
            height: 200px;
            background-color: red;
            position: relative;
            left: 200px;
            top: 200px;
        }

        /* 绝对定位：脱离文档流，可能会覆盖其他元素 */
        .box1{
            width: 200px;
            height: 200px;
            background-color: blue;
            position: absolute;
            left: 100px;
            top: 200px;
            /*z-index值越大越靠上层显示  */
            z-index: 100;
        }
        .box2{
            width: 200px;
            height: 200px;
            background-color: purple;
            position: absolute;
            left: 50px;
            top: 100px;
            z-index: 50;
        }

      

    </style>
</head>
<body>

    <div></div>
    <div class="box1"></div>
    <div class="box2"></div>
   
    
</body>
</html>